small fix for border drawing bug
authorLars Hamann <lars@src.gnome.org>
Tue, 28 Jul 1998 21:43:04 +0000 (21:43 +0000)
committerLars Hamann <lars@src.gnome.org>
Tue, 28 Jul 1998 21:43:04 +0000 (21:43 +0000)
* gtk/gtknotebook.c (gtk_notebook_paint): small fix for border drawing
  bug

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtknotebook.c

index c7f34a22de2e3e1fcf81ed322801e5d3e5943592..90d34c65c7554085f7b261bc7f2730c795bdfe39 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jul 28 00:03:20 1998  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_paint): small fix for border drawing
+       bug
+
 Tue Jul 28 00:15:28 CDT 1998 Shawn T. Amundson <amundson@gtk.org>
 
        * docs/gdk.sgml: new format for GDK documentation.  Eventually
index c7f34a22de2e3e1fcf81ed322801e5d3e5943592..90d34c65c7554085f7b261bc7f2730c795bdfe39 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 28 00:03:20 1998  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_paint): small fix for border drawing
+       bug
+
 Tue Jul 28 00:15:28 CDT 1998 Shawn T. Amundson <amundson@gtk.org>
 
        * docs/gdk.sgml: new format for GDK documentation.  Eventually
index c7f34a22de2e3e1fcf81ed322801e5d3e5943592..90d34c65c7554085f7b261bc7f2730c795bdfe39 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 28 00:03:20 1998  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_paint): small fix for border drawing
+       bug
+
 Tue Jul 28 00:15:28 CDT 1998 Shawn T. Amundson <amundson@gtk.org>
 
        * docs/gdk.sgml: new format for GDK documentation.  Eventually
index c7f34a22de2e3e1fcf81ed322801e5d3e5943592..90d34c65c7554085f7b261bc7f2730c795bdfe39 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 28 00:03:20 1998  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_paint): small fix for border drawing
+       bug
+
 Tue Jul 28 00:15:28 CDT 1998 Shawn T. Amundson <amundson@gtk.org>
 
        * docs/gdk.sgml: new format for GDK documentation.  Eventually
index c7f34a22de2e3e1fcf81ed322801e5d3e5943592..90d34c65c7554085f7b261bc7f2730c795bdfe39 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 28 00:03:20 1998  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_paint): small fix for border drawing
+       bug
+
 Tue Jul 28 00:15:28 CDT 1998 Shawn T. Amundson <amundson@gtk.org>
 
        * docs/gdk.sgml: new format for GDK documentation.  Eventually
index c7f34a22de2e3e1fcf81ed322801e5d3e5943592..90d34c65c7554085f7b261bc7f2730c795bdfe39 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 28 00:03:20 1998  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_paint): small fix for border drawing
+       bug
+
 Tue Jul 28 00:15:28 CDT 1998 Shawn T. Amundson <amundson@gtk.org>
 
        * docs/gdk.sgml: new format for GDK documentation.  Eventually
index c7f34a22de2e3e1fcf81ed322801e5d3e5943592..90d34c65c7554085f7b261bc7f2730c795bdfe39 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 28 00:03:20 1998  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_paint): small fix for border drawing
+       bug
+
 Tue Jul 28 00:15:28 CDT 1998 Shawn T. Amundson <amundson@gtk.org>
 
        * docs/gdk.sgml: new format for GDK documentation.  Eventually
index 744ab3d21eb4ae0333dfa99803888f062b1b73ef..e63e4ed00c36f373921d1b47baebe26bb59342a3 100644 (file)
@@ -1662,6 +1662,8 @@ gtk_notebook_paint (GtkWidget    *widget,
                }
              else
                {
+                 gint i = 0;
+
                  switch (notebook->tab_pos)
                    {
                    case GTK_POS_TOP:
@@ -1675,90 +1677,141 @@ gtk_notebook_paint (GtkWidget    *widget,
                      width -= notebook->cur_page->allocation.width;
                      break;
                    }
-
+                 
                  switch (notebook->tab_pos)
                    {
                    case GTK_POS_TOP:
-                     points[0].x = notebook->cur_page->allocation.x;
-                     points[0].y = y;
-                     points[1].x = x;
-                     points[1].y = y;
-                     points[2].x = x;
-                     points[2].y = y + height - 1;
-                     points[3].x = x + width - 1;
-                     points[3].y = y + height - 1;
-                     points[4].x = x + width - 1;
-                     points[4].y = y;
-                     points[5].x = (notebook->cur_page->allocation.x +
-                                    notebook->cur_page->allocation.width -
-                                    widget->style->klass->xthickness);
-                     points[5].y = y;
-
-                     if (points[5].x == (x + width))
-                       points[5].x -= 1;
+                     if (x != notebook->cur_page->allocation.x)
+                       {
+                         points[i].x = notebook->cur_page->allocation.x;
+                         points[i++].y = y;
+                       }
+
+                     points[i].x = x;
+                     points[i++].y = y;
+                     points[i].x = x;
+                     points[i++].y = y + height - 1;
+                     points[i].x = x + width - 1;
+                     points[i++].y = y + height - 1;
+                     points[i].x = x + width - 1;
+                     points[i++].y = y;
+
+                     if ((notebook->cur_page->allocation.x +
+                          notebook->cur_page->allocation.width -
+                          widget->style->klass->xthickness) <
+                         x + width - widget->style->klass->xthickness)
+                       {
+                         points[i].x = (notebook->cur_page->allocation.x +
+                                        notebook->cur_page->allocation.width -
+                                        widget->style->klass->xthickness);
+
+                         if (points[i].x == (x + width))
+                           points[i].x -= 1;
+
+                         points[i++].y = y;
+                       }
                      break;
+
                    case GTK_POS_BOTTOM:
-                     points[0].x = (notebook->cur_page->allocation.x +
-                                    notebook->cur_page->allocation.width -
-                                    widget->style->klass->xthickness);
-                     points[0].y = y + height - 1;
-                     points[1].x = x + width - 1;
-                     points[1].y = y + height - 1;
-                     points[2].x = x + width - 1;
-                     points[2].y = y;
-                     points[3].x = x;
-                     points[3].y = y;
-                     points[4].x = x;
-                     points[4].y = y + height - 1;
-                     points[5].x = notebook->cur_page->allocation.x;
-                     points[5].y = y + height - 1;
-
-                     if (points[0].x == (x + width))
-                       points[0].x -= 1;
+                     if ((notebook->cur_page->allocation.x +
+                          notebook->cur_page->allocation.width -
+                          widget->style->klass->xthickness) <
+                         x + width - widget->style->klass->xthickness)
+                       {
+                         points[i].x = (notebook->cur_page->allocation.x +
+                                        notebook->cur_page->allocation.width -
+                                        widget->style->klass->xthickness);
+
+                         if (points[i].x == (x + width))
+                           points[i].x -= 1;
+
+                         points[i++].y = y + height - 1;
+                       }
+
+                     points[i].x = x + width - 1;
+                     points[i++].y = y + height - 1;
+                     points[i].x = x + width - 1;
+                     points[i++].y = y;
+                     points[i].x = x;
+                     points[i++].y = y;
+                     points[i].x = x;
+                     points[i++].y = y + height - 1;
+                     
+                     if (notebook->cur_page->allocation.x != x)
+                       {
+                         points[i].x = notebook->cur_page->allocation.x;
+                         points[i++].y = y + height - 1;
+                       }
                      break;
+
                    case GTK_POS_LEFT:
-                     points[0].x = x;
-                     points[0].y = (notebook->cur_page->allocation.y +
-                                    notebook->cur_page->allocation.height -
-                                    widget->style->klass->ythickness);
-                     points[1].x = x;
-                     points[1].y = y + height - 1;
-                     points[2].x = x + width - 1;
-                     points[2].y = y + height - 1;
-                     points[3].x = x + width - 1;
-                     points[3].y = y;
-                     points[4].x = x;
-                     points[4].y = y;
-                     points[5].x = x;
-                     points[5].y = notebook->cur_page->allocation.y;
-                     
-                     if (points[0].y == (y + height))
-                       points[0].y -= 1;
+                     if ((notebook->cur_page->allocation.y +
+                          notebook->cur_page->allocation.height -
+                          widget->style->klass->ythickness) <
+                         y + height - widget->style->klass->ythickness)
+                       {
+                         points[i].x = x;
+                         points[i++].y = notebook->cur_page->allocation.y +
+                           notebook->cur_page->allocation.height -
+                           widget->style->klass->ythickness;
+
+                         if (points[0].y == (y + height))
+                           points[0].y -= 1;
+                       }
+                 
+                     points[i].x = x;
+                     points[i++].y = y + height - 1;
+                     points[i].x = x + width - 1;
+                     points[i++].y = y + height - 1;
+                     points[i].x = x + width - 1;
+                     points[i++].y = y;
+                     points[i].x = x;
+                     points[i++].y = y;
+
+                     if (notebook->cur_page->allocation.y != y)
+                       {
+                         points[i].x = x;
+                         points[i++].y = notebook->cur_page->allocation.y;
+                       }
                      break;
+
                    case GTK_POS_RIGHT:
-                     points[0].x = x + width - 1;
-                     points[0].y = notebook->cur_page->allocation.y;
-                     points[1].x = x + width - 1;
-                     points[1].y = y;
-                     points[2].x = x;
-                     points[2].y = y;
-                     points[3].x = x;
-                     points[3].y = y + height - 1;
-                     points[4].x = x + width - 1;
-                     points[4].y = y + height - 1;
-                     points[5].x = x + width - 1;
-                     points[5].y = (notebook->cur_page->allocation.y +
-                                    notebook->cur_page->allocation.height -
-                                    widget->style->klass->ythickness);
-
-                     if (points[5].y == (y + height))
-                       points[5].y -= 1;
+                     if (notebook->cur_page->allocation.y != y)
+                       {
+                         points[i].x = x + width - 1;
+                         points[i++].y = notebook->cur_page->allocation.y;
+                       }
+
+                     points[i].x = x + width - 1;
+                     points[i++].y = y;
+                     points[i].x = x;
+                     points[i++].y = y;
+                     points[i].x = x;
+                     points[i++].y = y + height - 1;
+                     points[i].x = x + width - 1;
+                     points[i++].y = y + height - 1;
+
+                     if ((notebook->cur_page->allocation.y +
+                          notebook->cur_page->allocation.height -
+                          widget->style->klass->ythickness) <
+                         y + height - widget->style->klass->ythickness)
+                       {
+                         points[i].x = x + width - 1;
+                         points[i++].y = notebook->cur_page->allocation.y +
+                           notebook->cur_page->allocation.height -
+                           widget->style->klass->ythickness;
+
+                         if (points[i - 1].y == (y + height))
+                           points[i - 1].y -= 1;
+                       }
                      break;
+
                    }
-                 
-                 gtk_draw_polygon (widget->style, widget->window,
-                                   GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                                   points, 6, FALSE);
+
+                   gtk_draw_polygon (widget->style, widget->window,
+                                     GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+                                     points, i, FALSE);
+
                }
              children = g_list_last (notebook->children);
              showarrow = FALSE;